package theOrbalEra.common;

import theOrbalEra.common.block.OrbalItemBlock;
import theOrbalEra.common.player.PlayerHandler;
import theOrbalEra.common.util.DefultValue;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.Item;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.TickRegistry;
import cpw.mods.fml.relauncher.Side;

public class CommonProxy {
	
	public boolean loadedMod = false;
	public void registerRenderInformation(){
		
	}

	public void onLoad() {
		TickRegistry.registerTickHandler(new TickHandler(), Side.SERVER);
	


	}
	
	public void onTickInGame() {
		String[] usernames = FMLCommonHandler.instance().getMinecraftServerInstance().getAllUsernames();
		for(int i = 0; i < usernames.length; i++) {
			EntityPlayerMP player = FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().getPlayerForUsername(usernames[i]);
			if(PlayerHandler.getPlayer(player.username) != null) {
				PlayerHandler.getPlayer(usernames[i]).getStats().onTick(player, player);
			}
		}
	}

	public String getCurrentLanguage() {

		return null;
	}
	
	public void registerBlock(Block block) {
	GameRegistry.registerBlock(block, OrbalItemBlock.class, block.getUnlocalizedName(), DefultValue.ModId);
	}
	public void registerItem(Item item) {
		GameRegistry.registerItem(item,item.getUnlocalizedName(), DefultValue.ModId);
	}


		
	
	
	

}
